﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 逻辑
{
    public class 象:QiZi
    {
        public 象(int x, int y, QiPan q, Button[,] b,int p) : base("象", x, y, q, p, b)
        {
        }
        public override void CanPut()
        {
            canPut.Clear();
            if ((x + 2 >= 0 && x + 2 <= 4 && y + 2 >= 0 && y + 2 <= 8) && (buttons[x + 1, y + 1].Tag == null)
                && (buttons[x + 2, y + 2].Tag == null || (buttons[x + 2, y + 2].Tag as QiZi).Player != this.Player))
            {
                int z = Game.ChangeDirection(this.Player, x + 2);
                canPut.Add(z * 10 + y + 2);
            }
            if ((x - 2 >= 0 && x - 2 <= 4 && y + 2 >= 0 && y + 2 <= 8) && (buttons[x - 1, y + 1].Tag == null)
               && (buttons[x - 2, y + 2].Tag == null || (buttons[x - 2, y + 2].Tag as QiZi).Player != this.Player))
            {
                int z = Game.ChangeDirection(this.Player, x - 2);
                canPut.Add(z * 10 + y + 2);
            }
            if ((x + 2 >= 0 && x + 2 <= 4 && y - 2 >= 0 && y - 2 <= 8) && (buttons[x + 1, y - 1].Tag == null)
               && (buttons[x + 2, y - 2].Tag == null || (buttons[x + 2, y - 2].Tag as QiZi).Player != this.Player))
            {
                int z = Game.ChangeDirection(this.Player, x + 2);
                canPut.Add(z * 10 + y - 2);
            }
            if ((x - 2 >= 0 && x - 2 <= 4 && y - 2 >= 0 && y - 2 <= 8) && (buttons[x - 1, y - 1].Tag == null)
               && (buttons[x - 2, y - 2].Tag == null || (buttons[x - 2, y - 2].Tag as QiZi).Player != this.Player))
            {
                int z = Game.ChangeDirection(this.Player, x - 2);
                canPut.Add(z * 10 + y - 2);
            }
        }
    }
}
